package com.huang.es;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @author 黄自祥
 * @date 2022/01/16 13:38
 * @Description:
 */
public class ESClient {

    public static RestHighLevelClient getClient() {
                 //创建HttpHost
                 HttpHost host = new HttpHost("114.115.217.143", 9200);

                 // 创建RestClientBuilder
                 RestClientBuilder builder = RestClient.builder(host);

                 // 创建RestHighLevelClient
                 RestHighLevelClient client = new RestHighLevelClient(builder);

                 return client;
             }
}
